package com.woniuxy01;

import java.io.FileInputStream;
import java.io.IOException;

public class Test05 {
    public static void main(String[] args) throws IOException {
        //读数据：输入流
        FileInputStream fis = new FileInputStream("a.txt");
        //实际项目数组的长度一般使用1024的整数倍
        byte[] bytes=new byte[3];
        //int read(byte b[])一次读取一个字节数组
        //读到的数据存储在数组中，返回值代表读到了几个有效字节
        int length=0;
        while((length=fis.read(bytes))!=-1){
            System.out.println(new String(bytes,0,length));
        }
        fis.close();

//        System.out.println(fis.read(bytes));
//        System.out.println(new String(bytes));
//        System.out.println(fis.read(bytes));
//        System.out.println(new String(bytes));
//        System.out.println(fis.read(bytes));
//        System.out.println(new String(bytes));
//        System.out.println(fis.read(bytes));
//        System.out.println(new String(bytes));

    }
}
